<%--
  Created by IntelliJ IDEA.
  User: zhang
  Date: 2023/6/18
  Time: 16:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <title>学生信息管理</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
</head>

<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <center><h1 style="color: #f56c6c">学生信息管理</h1></center>
        <br>
        <h1>学生管理</h1>
    </div>

    <%--<div class="box">--%>
        <%--<div class="filter-container">--%>
            <%--<el-form ref="dataAddForm" :model="formData" :rules="rules" label-position="right" label-width="100px">--%>
                <%--<el-row>--%>
                    <%--<el-col :span="5">--%>
                        <%--<el-form-item label="id" prop="custormer_id">--%>
                            <%--<el-input v-model="formData.custormer_id"/>--%>
                        <%--</el-form-item>--%>
                    <%--</el-col>--%>
                    <%--<el-col :span="5">--%>
                        <%--<el-button type="primary" class="butT" @click="getSimilarFilms()">查询某一用户的推荐电影列表</el-button>--%>
                    <%--</el-col>--%>
                <%--</el-row>--%>
            <%--</el-form>--%>

        <%--</div>--%>
    <div>

    <label for="student-name">输入学生姓名：</label>
        <form class="form-horizontal " role="form"  action="query" method="post"  >
    <input type="text" id="student-name" name ="name"><br>
    <%--<label for="student-gpa">输入学生绩点：</label>--%>
    <%--<input type="text" id="student-gpa"><br>--%>
    <%--<label for="student-subject">输入学生学科：</label>--%>
    <%--<input type="text" id="student-subject"><br>--%>
    <button id="search-btn">查询</button>
    <div id="result"></div>
    <script>
        document.getElementById('search-btn').addEventListener('click', function() {
            var name = document.getElementById('student-name').value;
            // var gpa = document.getElementById('student-gpa').value;
            // var subject = document.getElementById('student-subject').value;
            var xhr = new XMLHttpRequest();
            xhr.open('POST', '/query', true);
            xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
            xhr.onreadystatechange = function() {
                if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
                    document.getElementById('result').innerHTML = xhr.responseText;
                }
            };
            xhr.send(JSON.stringify({ name: name }));
        });
    </script>
    </div>
</div>
    <div class="box">



        <table style="width: 100%">
            <tr>
                <td style="width: 1%; height: 300px; background-color: #AFDCEC">
                </td>
                <td style="width: 49%; height: 300px; background-color: #AFDCEC">
                    <p>
                    <h2>&nbsp;&nbsp; 请您查询 </h2>
                    </p>

                </td>
                <td style="width: 50%; height: 300px;background-color: #E5E4E2">
                    <div >
                        <el-table size="small" current-row-key="id" :data="dataList" stripe highlight-current-row>
                            <el-table-column type="index" align="center" label="序号"></el-table-column>
                            <el-table-column prop="release_year" label="发行年份"  align="center"></el-table-column>
                            <el-table-column prop="title" label="电影名称"  align="center"></el-table-column>
                            <el-table-column prop="description" label="简介"  align="center"></el-table-column>
                            <el-table-column label="操作" align="center">
                                <template slot-scope="scope">
                                    <el-button size="mini" type="danger"> X -删除</el-button>
                                </template>
                            </el-table-column>
                        </el-table>

                        <div class="pagination-container">
                            <el-pagination
                                    class="pagiantion"
                                    @current-change="handleCurrentChange"
                                    :current-page="pagination.currentPage"
                                    :page-size="pagination.pageSize"
                                    layout="total, prev, pager, next, jumper"
                                    :total="pagination.total">
                            </el-pagination>
                        </div>

                    </div>

                </td>
            </tr>
        </table>
    </div>

</div>
</body>

<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/stu_recom.jsp"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script>
    var vue = new Vue({
        el: '#app',
        data: {
            dataList: [],//当前页要展示的分页列表数据
            formData: {},//查询某一个租赁用户的id
            dialogFormVisible: false,//增加表单是否可见
            dialogFormVisible4Edit: false,//编辑表单是否可见
            pagination: {},//分页模型数据，暂时弃用
        },

        //钩子函数，VUE对象初始化完成后自动执行
        created() {
            //this.getSimilarFilms();
        },

        methods: {
            // 重置表单
            resetForm() {
                //清空输入框
                this.formData = {};
            },

            //提交的是POST请求
            getSimilarFilms() {
                //alert(this.formData.custormer_id);
                axios.post("/index2.jsp", this.formData).then((res) => {

                    this.dataList = res.data; //把返回的数据和页面的数据绑定在一起了
            });
            },


        }
    })
</script>
</html>
